﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserMgr.aspx.cs" Inherits="OnlineManagement.Web.Account.UserMgr" %>

<%@ Register Assembly="OnlineControl" Namespace="OnlineControl" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
         #usersTable .hovertable
        {
            font-family: Verdana,Arial,Helvetica,sans-serif;
            font-size: 11px;
            color: #333333;
            border-width: 1px;
            border-color: #999999;
            border-collapse: collapse;
        }
        #usersTable table.hovertable th
        {
            background-color: #c3dde0;
            border-width: 1px;
            padding: 8px;
            border-style: solid;
            border-color: #a9c6c9;
        }
        #usersTable table.hovertable tr
        {
            background-color: #d4e3e5;
        }
        #usersTable table.hovertable td
        {
            border-width: 1px;
            padding: 8px;
            border-style: solid;
            border-color: #a9c6c9;
        }
    </style>
    <link href="../resources/css/colorbox.css" rel="stylesheet" type="text/css" />
    <script src="../resources/scripts/jquery-1.10.2.js" type="text/javascript"></script>
    <script src="../resources/scripts/jquery.colorbox.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
            //$("#<%=lbDelUserName.ClientID %>").text("aaa");
        });
        function changePws(name) {
            //var name = $(obj).parent().parent().find("span[id=userName]").val();
            $("#<%=lbChangePwd.ClientID %>").text(name);
            colorB("#changPwd");
        }
        function delUser(name) {
            //var name = $(obj).parent().parent().find("span[id=userName]").val();
            $("#<%=lbDelUserName.ClientID %>").text(name);
            colorB("#delUser");
        }

        function colorB(url) {
            $("body").append("<div class='overlay1'></div>");
            var docHieght = $(document).height();
            $(".overlay1").height(docHieght).
                                            css({
                                                'opacity': 0.5,
                                                'position': 'absolute',
                                                'top': 0,
                                                'left': 0,
                                                'background': 'url(../resources/images/overlay.png) repeat 0 0',
                                                'width': '100%',
                                                'z-index': 1000
                                            });

     $.colorbox({ href: url,
                iframe: false,
                inline: true,
                opacity: 0.5,
                width: "628px",
                height: "540px",
                transition: "fade",
                scrolling: false,
                onClosed: function () {
                    //$("#scrpt").remove();
                    window.location.reload();
                }
            });

           
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
   
   <div id="usersTable">
        <cc1:Repeater ID="rptUsers" runat="server" EnableViewState="false">
            <HeaderTemplate>
                <table class="hovertable">
                    <thead>
                        <tr>
                            <th>
                                用户名
                            </th>
                            <th>
                                创建时间
                            </th>
                            <th>
                                最近登录时间
                            </th>
                            <th>
                                是否被锁
                            </th>
                            <th>是否在线</th>
                            <th>
                                操作
                            </th>
                        </tr>
                    </thead>
                    <tbody>
            </HeaderTemplate>
            <ItemTemplate>
                <tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">
                    <td>
                        <span id="userName">
                            <%#Eval("UserName")%></span>
                    </td>
                    <td>
                        <%#Eval("CreationDate","{0:yyyy年MM月dd日}") %>
                    </td>
                    <td>
                        <%#Eval("LastLoginDate", "{0:yyyy年MM月dd日}")%>
                    </td>
                    <td>
                        <%#Eval("IsLockedOut")%>
                    </td>
                    <td>
                        <%#Eval("IsOnline") %>
                    </td>
                    <td>
                        <a href="javascript:void(0);" onclick="changePws('<%#Eval("UserName")%>');">修改密码</a>
                        <a href="javascript:void(0);" onclick="delUser('<%#Eval("UserName")%>');">删除用户</a>
                        <a href="javascript:void(0);" onclick="deActivityUser('<%#Eval("UserName")%>');">反激活</a>
                        
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                </tbody> </table>
            </FooterTemplate>
        </cc1:Repeater>
    </div>

    <div style=" display:block">
        <div id="changPwd" style='background:#fff;'>
        <p>您确认要更改<asp:Label runat="server" ID="lbChangePwd"></asp:Label>的密码吗？</p>
         <p>密码: <asp:TextBox runat="server" ID="txtPwd" TextMode="Password"></asp:TextBox></p> 
         <p>确认密码:<asp:TextBox runat="server" ID="txtConrimPwd" TextMode="Password"></asp:TextBox></p>
         <p>
            <asp:Button runat="server" ID="btnChangPwd" Text="修改密码" />
         </p>
         <p>
            <asp:Label runat="server" ID="lbChangePwdMsg"></asp:Label>
         </p>
        </div>
    </div>
    <div style=" display:none">
        <div id="activityUser" style='background:#fff;'>
            <p>激活 <span id="deactivityUserName"></span> 用户</p>
            <input type="button" id="btnActivityUser" />
        </div>
    </div>
    <div style=" display:none;background:#fff">
        <div id="delUser">
            <p>删除
            <asp:Label runat="server" ID="lbDelUserName"></asp:Label>用户
            </p>
            <p>
                <asp:Button runat="server" ID="btnDelUser" Text="删除用户" />
            </p>
            <p>
               <asp:Label runat="server" ID="lbDelMsg"></asp:Label> 
            </p>
        </div>
    </div>

    <div style=" display:none">
        <div id="disactivityUser" style='background:#fff;'>
            <p>反激活 <span id="Span1"></span> 用户</p>
            <input type="button" id="btnDisactivityUser" />
        </div>
    </div>

    <div style="display: none">
        <div id="autoClose" style='background:#fff;'>
            <span>Saved successfully.</span>
            <div id="show"><label id="lbSecond">3</label>
                秒后自动关闭</div>
        </div>
    </div>

   
    </form>
</body>
</html>
